package org.alvin.gencode.swaggerapidoc;

import lombok.extern.slf4j.Slf4j;
import org.alvin.code.jdbc.ConnectionUtils;
import org.alvin.gencode.beans.PropConfig;
import org.alvin.gencode.inters.GenInterfaceService;
import org.alvin.gencode.utils.ConfigUtil;
import org.alvin.mini_inject.annotations.MiniComponent;
import org.alvin.mini_inject.annotations.MiniInject;
import org.alvin.mini_inject.annotations.MiniRun;

import java.io.IOException;

/**
 * swagger api 生成器 配置类
 */
@Slf4j
@MiniComponent
public class SwaggerApiDocPluginConfig {
    @MiniInject
    private SwaggerApiDocService swaggerApiDocService;

    @MiniRun
    public void start(){
        System.out.println("----------------------------------------------------");
        try {
            log.info("启动配置加载");
            PropConfig propConfig = ConfigUtil.initConfig();
            log.info("生成文档");
            this.swaggerApiDocService.genDoc(propConfig);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
